<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/control/city_linkage/css/city-picker.css')}}"/>
    <link rel="stylesheet" href="{{asset('/css/web/user/pw_revise.css')}}">
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.seller_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title">邀请员工</div>
                <div class="revise_subnav">
                    <ul>
                        <li class="cur">手机号码</li>
                        <li>验证码</li>
                        <li>完成</li>
                    </ul>
                </div>
                <div class="revise_content">
                    <div class="box">
                        <form action="{{url('/member/seller/member/create2')}}" method="post" onsubmit="return frm_data_check();" id="js-frm-pwrevise">
                            <ul>
                                <li>
                                    <span>手机号码：</span>
                                    <input name='phone' id='phone' type="text" class="se getborder" value="" />
                                    <p class="jm_error"></p>
                                </li>
                                <input type="hidden" name="_token" value="{{csrf_token()}}" />
                            </ul>
                            <input type="submit" class="jm_btn6 submit" value="下一步" />
                        </form>
                    </div>
                    <div class="j-err" style="margin-left:312px; margin-top: 32px; color: red; font-size: large;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
</body>
<script>
function frm_data_check() {
    var phone=/^1[34578]\d{9}$/; //手机号
    var _frm = $('#js-frm-pwrevise');
    var _phone = _frm.find('input[name="phone"]'), _code = _frm.find('input[name="code"]');
    console.log(_phone.val())
    if (_phone.val() == ''){
        _phone.parent().find('.jm_error').html('手机号码 必须填写');
        return false;
    }
    if(!phone.test(_phone.val())){
        _phone.parent().find('.jm_error').html('手机号码 格式错误!');
        return false;
    }
    var _url = '/member/seller/member/checkphone';
    var flag = false;
    // 验证该手机号是否是系统会员
    $.ajax({
        url: _url,
        data:{phone: _phone.val(), _token:"{{csrf_token()}}"},
        type:'POST',
        async:false,
        success:function (res) {
            if (res.code != 0) {
                _phone.parent().find('.jm_error').html(res.message);
                return false;
            } else {
                flag = true;
            }
        },
        error:function (error) {
            _phone.parent().find('.jm_error').html(error.message);
            return false;
        }
    });

    if (flag==false){
        return false;
    }
}
</script>
</html>